#region License
// Copyright (c) 2007 James Newton-King
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
#endregion

using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;
using Utilities.Miscellaneous;
using System.Globalization;
using System.Data.SqlTypes;
using System.IO;
using Utilities.Testing;
using Utilities.Web;

namespace Utilities.Test.Web
{
  public class UrlBuilderFixture : TestFixtureBase
  {
    #region UrlParsing
    [Test]
    public void Constructor()
    {
      UriBuilder c = new UriBuilder("http://en.wikipedia.org/wiki/USS_Pueblo_%28AGER-2%29");
      //UrlBuilder c;

      //c = new UrlBuilder("http://msdn2.microsoft.com/en-us/library/system.type.isgenericparameter.aspx");

      //Assert.AreEqual("http://msdn2.microsoft.com/en-us/library/system.type.isgenericparameter.aspx", c.Path);
      //Assert.AreEqual(0, c.QueryString.Count);
      //Assert.AreEqual(null, c.Target);
      //Assert.AreEqual("http://msdn2.microsoft.com/en-us/library/system.type.isgenericparameter.aspx", c.ToString());

      //c = new UrlBuilder("http://www.google.co.nz/search?hl=en&q=.net&meta=");

      //Assert.AreEqual("http://www.google.co.nz/search", c.Path);
      //Assert.AreEqual(3, c.QueryString.Count);
      //Assert.AreEqual(null, c.Target);
      //Assert.AreEqual("http://www.google.co.nz/search?hl=en&q=.net&meta=", c.ToString());

      //c = new UrlBuilder("http://en.wikipedia.org/wiki/USS_Pueblo_%28AGER-2%29");
      //Assert.AreEqual(0, c.QueryString.Count);
      //Assert.AreEqual("http://en.wikipedia.org/wiki/USS_Pueblo_(AGER-2)", c.Path);
      //Assert.AreEqual(null, c.Target);
      //Assert.AreEqual("http://en.wikipedia.org/wiki/USS_Pueblo_%28AGER-2%29", c.ToString());

      //c = new UrlBuilder("http://www.tecqualcheck.tec.govt.nz/login.aspx?ReturnUrl=%7e%2fapplication%2forganization.aspx%3fnextUrl%3d%257e%252fapplication%252fapplications.aspx&previousUrl=%2fDefault.aspx");


      //c = new UrlBuilder("http://www.abc.com?hl=en&q=.net&meta=&s=1&s=2");
      //Assert.AreEqual(c.QueryString.GetValues("s").Length, 2);
      //Assert.AreEqual(c.QueryString.GetValues("s")[0], "1");
      //Assert.AreEqual(c.QueryString.GetValues("s")[1], "2");

    }
    #endregion

    [Test]
    [ExpectedException(typeof(ArgumentNullException), ExpectedMessage = @"Value cannot be null.
Parameter name: url")]
    public void UrlBuilderNull()
    {
      UrlBuilder c = new UrlBuilder(null);
    }
  }
}